package 韩顺平集合.List;

import java.util.ArrayList;
import java.util.List;

public class p7ListMethod {
    public static void main(String[] args) {
        //List接口中元素有序即添加顺序和取出顺序一致,且可重复
        List list = new ArrayList();
        list.add("杜绍聪");
        list.add(0,"王思聪");
        System.out.println(list.get(0));
        List list2=new ArrayList();
        list2.add("一根葱");
        list2.addAll(0,list);
        System.out.println(list2);

        //找到指定元素的索引
        int i = list.indexOf("杜绍聪");
        System.out.println(i);


    }
}
